package com.dingding.study.service.事件发布机制;

import com.google.common.eventbus.EventBus;

/**
 * @program: spring-learning
 * @description:
 * @author: liugongding
 * @create: 2021-09-10 11:58
 **/
public class MessageEventDemo {

    public static void main(String[] args){
        EventBus eventBus = new EventBus("test");
        //注册监听到eventBus
        eventBus.register(new EventListener());
        //通过eventBus发送两笔消息
//        eventBus.post(new Event("send message1"));
//        eventBus.post(new Event("send message2"));
        System.out.println("发布方方线程"+Thread.currentThread().getName());

    }
}
